<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%
	request.setAttribute("title","我的课题组");
	request.setAttribute("modelConfigPath", "group");
%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/index.jsp"%>
<style>
	body {
		color:white;
		font-size:16px;
	}
	.panel-heading {
		background: transparent  !important;
	}
	.panel-footer {
		border-top: none;
		background: transparent;
	}
	.panel {
		background-image: url(<c:url value="/images/woods/view.jpg" />) !important;
		background-size: cover;
		background-repeat: no-repeat;
		color:white !important;
		border: none;
	}
	input {
		background:rgba(0,0,0,0)  !important;
		color:white !important;
	}
	label {
		margin-top: 25px;
	}
	textarea {
		background:rgba(0,0,0,0)  !important;
		color:white !important;
	}
	span {
		background:rgba(0,0,0,0)  !important;
		color:white !important;
	}
	.select2-search--dropdown {
		background-color: rgba(0,0,0,0.4) !important;
	}
	ul {
		background-color: rgba(0,0,0,0.4);
	}
	li:hover {
		background-color: #81C784 !important;
	}
	.panel-body {
		margin: 0 auto;
		width: 80%;
		background: rgba(0,0,0,0.4);
	}
	form#group {
		padding: 30px;
		margin: 0 auto;
		width: 80%;
	}
	.form-control {
		color: white !important;
		font-size: 16px;
	}
	h6.panel-title, .h6.panel-title {
		font-size: 30px;
		margin-top:20px;
		margin-bottom: 30px;
	}

</style>

<t:panel cssClass="panel-flat form-detailed form-xs" customBody="true" customHead="true">
	<center><t:panelHead title='我的课题组'></t:panelHead></center>
	<div class="detailed-navbar-content panel-body" >
		<t:form commandName="group" action="/admin/group/save" method="post" cssClass="form-horizontal">
			<div class="hide">
				<t:hidden path="groupId"/>
			</div>
			<t:formgroup>
				<t:label path="groupName" />
				<t:input path="groupName" />
			
			
				<t:label path="schoolId"/>
				<t:select2 path="schoolId"/>
				<t:label path="academyId"/>
				<t:select2 path="academyId"/>

				<t:label path="comments"/>
				<t:textarea path="comments" rows="5"/>
			</t:formgroup>
		</t:form>
	</div>
	<t:panelFoot headingBtnCssClass="heading-btn pull-right-important">
		<t:button icon="icon-floppy-disk" id="saveButton" onclick="saveData()" cssClass="btn-info" csize="sm">保存</t:button>
	</t:panelFoot>
</t:panel>

<script type="text/javascript">

	$(function(){
		var str1 = '${sessionScope.session_account_info.loginName}';
		//alert(str1);
		var str2 = $("#dutyName").val();

		if(str1!=str2){
			$('#saveButton').css({ "display": "none" });		
			$('input').attr("readonly",true);
			$('textarea').attr("readonly",true);
		}
		
		$("#schoolId").on("change",function(){
			loadAcademy($("#schoolId").val());
		});
		if($("#schoolId").val()!=null && $("#schoolId").val()!= '' ){
			loadAcademy($("#schoolId").val());
		}
	});
	function saveData(){
		if (!$("form:first").valid()){
			return;
		}
		$("form:first").submit();
	}
	
	function loadAcademy(schoolId){
		var selectId = null;
		var url = $.getVirtualPath()+"/admin/baseInfo/academy/getAcademyBySchoolId?schoolId="+schoolId;
		var items = $.getJson(url);
		selectId = $("#academyId").val(); 
		renderAcademy(items,selectId);
	}
	
	function renderAcademy(items,selectId){
		var options = [];
		if($.isNull(items)){
			$("#academyId").empty();	
			return null;
		}
		options.push("<option value=''></option>");
		$.each(items,function(index,item){
			if(item.value == selectId){
				options.push($("<option selected='selected' value='"+item.value+"'>"+item.text+"</option>"));
			}else{
				options.push($("<option value='"+item.value+"'>"+item.text+"</option>"));
			}
		});
		
		$("#academyId").empty();
		$("#academyId").append(options);
	}
</script>

<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared//master/contentFooter.jsp"%>
